﻿using System;
using System.Collections.Generic;
using Character;
using UnityEngine;

namespace H
{
	// Token: 0x02000256 RID: 598
	internal abstract class H_State_AfterBase : H_State
	{
		// Token: 0x06000FD6 RID: 4054 RVA: 0x00066354 File Offset: 0x00064554
		public H_State_AfterBase(H_Members members) : base(members)
		{
			this.breath = new bool[members.GetFemales().Count];
			for (int i = 0; i < this.breath.Length; i++)
			{
				this.breath[i] = false;
			}
		}

		// Token: 0x06000FD7 RID: 4055 RVA: 0x000663A8 File Offset: 0x000645A8
		public override void In(H_State.Message msg)
		{
			List<Female> females = this.members.GetFemales();
			if (this.breath.Length != females.Count)
			{
				this.breath = new bool[females.Count];
			}
			bool flag = this.VisitorVoice();
			for (int i = 0; i < females.Count; i++)
			{
				bool flag2 = false;
				if (!flag)
				{
					flag2 = this.members.VoiceExpression(i, H_Voice.TYPE.XTC_AFTER_TALK);
				}
				if (!flag2)
				{
					flag2 = this.members.VoiceExpression(i, H_Voice.TYPE.XTC_AFTER_BREATH);
					this.breath[i] = true;
				}
			}
			this.members.MaleExpression(H_Expression_Male.TYPE.NORMAL);
		}

		// Token: 0x06000FD8 RID: 4056 RVA: 0x00066444 File Offset: 0x00064644
		private bool VisitorVoice()
		{
			if (this.members.h_scene.visitor != null && this.members.h_scene.visitor.GetHuman().sex == SEX.FEMALE)
			{
				int num = UnityEngine.Random.Range(0, this.visitorVoiceProbability);
				bool flag = num == 0;
				if (flag)
				{
					return this.members.h_scene.VisitorVoiceExpression(H_VisitorVoice.TYPE.AFTER);
				}
			}
			return false;
		}

		// Token: 0x06000FD9 RID: 4057 RVA: 0x000664B0 File Offset: 0x000646B0
		public override void Main()
		{
			this.UpdateVoice();
		}

		// Token: 0x06000FDA RID: 4058 RVA: 0x000664B8 File Offset: 0x000646B8
		protected void UpdateVoice()
		{
			List<Female> females = this.members.GetFemales();
			for (int i = 0; i < females.Count; i++)
			{
				if (!females[i].IsVoicePlaying())
				{
					H_Voice.TYPE voice = (!this.breath[i]) ? H_Voice.TYPE.XTC_AFTER_BREATH : H_Voice.TYPE.BREATH;
					this.breath[i] = true;
					this.members.VoiceExpression(i, voice);
				}
			}
		}

		// Token: 0x06000FDB RID: 4059 RVA: 0x00066528 File Offset: 0x00064728
		protected void OnInput_Extracted(H_INPUT input)
		{
			if (input == H_INPUT.CLICK_PAD)
			{
				base.CheckWeaknessStyle();
				if (this.members.StyleData.type == H_StyleData.TYPE.SERVICE && !this.members.StyleData.IsInMouth())
				{
					base.ChangeState(H_STATE.LOOP, null);
				}
				else
				{
					base.ChangeState(H_STATE.INSERT, null);
				}
			}
		}

		// Token: 0x06000FDC RID: 4060 RVA: 0x00066584 File Offset: 0x00064784
		protected void OnInput_Inserted(H_INPUT input)
		{
			if (input == H_INPUT.CLICK_PAD)
			{
				base.CheckWeaknessStyle();
				base.ChangeState(H_STATE.LOOP, null);
			}
			else if (input == H_INPUT.EXTRACT)
			{
				base.CheckWeaknessStyle();
				base.ChangeState(H_STATE.EXTRACT, null);
			}
		}

		// Token: 0x04001154 RID: 4436
		protected bool[] breath;

		// Token: 0x04001155 RID: 4437
		private int visitorVoiceProbability = 3;
	}
}
